﻿using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Drawing.Imaging;

namespace LineChart
{
    /// <summary>
    /// Summary description for WebForm1.
    /// </summary>
    public partial class WebForm1 : System.Web.UI.Page
    {
        private void Page_Load(object sender, System.EventArgs e)
        {
            Line2D line2d = new Line2D();

            line2d.Height = 400;
            line2d.Width = 700;
            line2d.XSlice = 50;
            line2d.YSlice = 10;
            line2d.XAxisText = "54658484";
            line2d.YAxisText = "Overs";
            line2d.Title = "India vs Pakistan";
            line2d.TitleBackColor = Color.Linen;
            line2d.TitleForeColor = Color.HotPink;

            line2d.InitializeGraph();


            ArrayList arX = new ArrayList();
            ArrayList arY = new ArrayList();

            arX.Add(0); arX.Add(120); arX.Add(150); arX.Add(175); arX.Add(210);
            arY.Add(0); arY.Add(100); arY.Add(50); arY.Add(150); arY.Add(190);
            line2d.XAxis = arX;
            line2d.YAxis = arY;
            line2d.CreateGraph(Color.LightCyan);


            arX = new ArrayList();
            arY = new ArrayList();
            arX.Add(0); arX.Add(110); arX.Add(160); arX.Add(195); arX.Add(200);
            arY.Add(0); arY.Add(10); arY.Add(90); arY.Add(150); arY.Add(160);
            line2d.XAxis = arX;
            line2d.YAxis = arY;
            line2d.CreateGraph(Color.Red);


            Bitmap bmp = line2d.GetGraph();
            bmp.Save(Response.OutputStream, ImageFormat.Jpeg);


        }

        #region Web Form Designer generated code
        override protected void OnInit(EventArgs e)
        {
            //
            // CODEGEN: This call is required by the ASP.NET Web Form Designer.
            //
            InitializeComponent();
            base.OnInit(e);
        }

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.Load += new System.EventHandler(this.Page_Load);
        }
        #endregion
    }
}
